package com.sisreq.elementos;

import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.ListSelectionModel;

import com.sisreq.objetos.CentroResultado;
import com.sisreq.objetos.TipoServico;

@SuppressWarnings("serial")
public class MyList extends JList {
	
	public MyList(List<TipoServico> tiposServico){
		super();
		DefaultListModel listModel = new DefaultListModel();
		for(int i = 0; i < tiposServico.size(); i++){
			listModel.addElement(tiposServico.get(i).get_nm_tipo_servico());
		}
		this.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
		this.setModel(listModel);
	}
	
	public MyList(List<CentroResultado> centros, boolean isCentro){
		super();
		DefaultListModel listModel = new DefaultListModel();
		for(int i = 0; i < centros.size(); i++){
			listModel.addElement(centros.get(i).get_nm_centro_resultado());
		}
		this.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
		this.setModel(listModel);
	}
}
